<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <textarea name="" id="txt1" cols="80" rows="40"></textarea>
  <input type="button" id="btn1" value="过滤">
  <textarea name="" id="txt2" cols="80" rows="40"></textarea>
  <script>
    window.onload = function() {
      const txt1 = document.getElementById('txt1')
      const txt2 = document.getElementById('txt2')
      const oBtn = document.getElementById('btn1')

      oBtn.onclick = function() {
        const re = /<[^<>]+>/g
        txt2.value = txt1.value.replace(re, '')
      }
    }
    
  </script>
</body>
</html>